$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'bss/apbase/fjlist',
        datatype: "json",
        colModel: [			
			{ label: 'guid', name: 'guid', index: 'guid', width: 50, key: true,hidden: true,
                // formatter: function (cellvalue, options, rowObject) {
                //     console.log("guid=="+cellvalue);
                // }
            },
			{ label: '附件名称', name: 'fName', index: 'f_name', width: 200 },
            {
                label: '操作', name: '', width: 100,
                formatter: function (cellvalue, options, rowObject) {
                     return "<a  class='btn btn-primary' onclick='showdown(\"" + rowObject.guid + "\" )' >&nbsp;下载</a>&nbsp;&nbsp;";
                 }
            }

        ],
		viewrecords: true,
        height:  500,
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
    
    
});

/**
 *  一键导出
 */
function clis() {
    var guids = getSelectedRows();
    if(guids == null){
        return ;
    }
    location.href=baseURL + "bss/batchDown/batchDown?guid="+GetUrlParam("guid")+"&fjguid="+guids;
}

/**
 *单独文件导出
 */
function showdown(guid)
{
	if(guid=="fj1") //  申请书
	{
        location.href=baseURL + "bss/apbase/exports?guid="+GetUrlParam("guid");
	}
    if(guid=="fj2") //  设备材料购置表
	{
        location.href=baseURL + "bss/apbase/exportsbymx?guid="+GetUrlParam("guid");
	}
	if(guid=="fj3") //  设备材料拆除表
	{
        location.href=baseURL + "bss/apbase/exportRemove?guid="+GetUrlParam("guid");
	}
    if(guid=="fj4") //  点位设备材料明细表
	{
        location.href=baseURL + "bss/apbase/exportsbypoint?guid="+GetUrlParam("guid");
	}
    if(guid=="fj5") //  材料汇总表
	{
		location.href=baseURL + "bss/apbase/exportsbyhz?guid="+GetUrlParam("guid");
	}
    if(guid=="fj6") //  点位照片表
	{
		location.href=baseURL + "bss/apbase/exportsimg?guid="+GetUrlParam("guid");
	}

}




var vm = new Vue({
	el:'#rrapp',
	data:{
		showList: true,
        fJ: {}
	},
	methods: {
        updown: function (event) {
			var guids = getSelectedRows();
			if(guids == null){
				return ;
			}


		}

	}
});